Math Adventures with Python by Peter Farrell

Math Adventures with Python by Peter Farrell

Author:Peter Farrell
Language: eng
Format: epub, pdf
Publisher: No Starch Press
Published: 2019-01-08T16:00:00+00:00


You can see that it diverges after four iterations because it gets bigger than two units away from the origin. Figure 7-7 graphs each step so you can visualize them.

Figure 7-7: Running the complex number 0.25 + 0.75 i through the mandelbrot() function until it diverges

The red circle has a radius of two units and represents the limit we put on the complex number diverging. When squaring and adding in the original value of z, we cause the locations of the numbers to rotate and translate and eventually to get further away from the origin than our rule allows.

Let’s use some of the graphing tricks we learned in Chapter 4 to graph points and functions in the Processing display. Copy and paste all the complex number functions from complex.py (cAdd, cMult, and magnitude) to the bottom of mandelbrot.pyde. We’ll use Processing’s println() function to print to the console the number of steps it takes a point to diverge. Add the code in Listing 7-4 before the mandelbrot() code you wrote in Listing 7-3.

mandelbrot.pyde

#range of x-values

xmin = -2

xmax = 2



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Popular ebooks
Whisky: Malt Whiskies of Scotland (Collins Little Books) by dominic roskrow(55926)
What's Done in Darkness by Kayla Perrin(26532)
Shot Through the Heart: DI Grace Fisher 2 by Isabelle Grey(19013)
The Fifty Shades Trilogy & Grey by E L James(18968)
Shot Through the Heart by Mercy Celeste(18885)
Wolf & Parchment: New Theory Spice & Wolf, Vol. 10 by Isuna Hasekura and Jyuu Ayakura(16992)
Python GUI Applications using PyQt5 : The hands-on guide to build apps with Python by Verdugo Leire(16883)
Peren F. Statistics for Business and Economics...Essential Formulas 3ed 2025 by Unknown(16810)
Wolf & Parchment: New Theory Spice & Wolf, Vol. 03 by Isuna Hasekura and Jyuu Ayakura & Jyuu Ayakura(16706)
Wolf & Parchment: New Theory Spice & Wolf, Vol. 01 by Isuna Hasekura and Jyuu Ayakura & Jyuu Ayakura(16334)
The Subtle Art of Not Giving a F*ck by Mark Manson(14271)
The 3rd Cycle of the Betrayed Series Collection: Extremely Controversial Historical Thrillers (Betrayed Series Boxed set) by McCray Carolyn(14075)
Stepbrother Stories 2 - 21 Taboo Story Collection (Brother Sister Stepbrother Stepsister Taboo Pseudo Incest Family Virgin Creampie Pregnant Forced Pregnancy Breeding) by Roxi Harding(13437)
Scorched Earth by Nick Kyme(12718)
Drei Generationen auf dem Jakobsweg by Stein Pia(10926)
Suna by Ziefle Pia(10851)
Scythe by Neal Shusterman(10277)
International Relations from the Global South; Worlds of Difference; First Edition by Arlene B. Tickner & Karen Smith(9483)
Successful Proposal Strategies for Small Businesses: Using Knowledge Management ot Win Govenment, Private Sector, and International Contracts 3rd Edition by Robert Frey(9318)
This is Going to Hurt by Adam Kay(9110)